@extends('admin::layouts.master')
@section('content')
    <div class="x_panel">
        <div class="x_title">
            <h2>用户管理 </h2>
            <ul class="nav navbar-right panel_toolbox">
                <li>
                    <!-- Small modal -->
                    <button type="button" class="btn btn-round btn-warning" data-toggle="modal" data-target=".bs-example-modal-sm"><i class="fa fa-user-plus"></i> 添加用户</button>
                    @component('components.modal',['class'=>'bs-example-modal-sm','title'=>'添加用户','url'=>'/admin/adminuser'])
                        <div class="form-group">
                            <label style="margin-top: 10px;" class="control-label col-md-4 col-sm-4 col-xs-12" for="first-name">登录账号 <span class="required">*</span>
                            </label>
                            <div class="col-md-8 col-sm-8 col-xs-12">
                                <input type="text" id="first-name" required="required" placeholder="请输入账号..." name="name" class="form-control col-md-7 col-xs-12">
                            </div>
                            <div class="clearfix"></div>
                        </div>
                        <div class="form-group">
                            <label style="margin-top: 10px;" class="control-label col-md-4 col-sm-4 col-xs-12" for="first-name">用户昵称 <span class="required">*</span>
                            </label>
                            <div class="col-md-8 col-sm-8 col-xs-12">
                                <input type="text" id="first-name" required="required" placeholder="请输入昵称..." name="nickname" class="form-control col-md-7 col-xs-12">
                            </div>
                            <div class="clearfix"></div>

                        </div>
                        <div class="form-group">
                            <label style="margin-top: 10px;" class="control-label col-md-4 col-sm-4 col-xs-12" for="first-name">登录密码 <span class="required">*</span>
                            </label>
                            <div class="col-md-8 col-sm-8 col-xs-12">
                                <input type="text" id="first-name" required="required" placeholder="请输入密码..." name="password" class="form-control col-md-7 col-xs-12">
                            </div>
                        </div>
                @endcomponent
                <!-- /modals -->
                </li>

            </ul>
            <div class="clearfix"></div>
        </div>
        <div class="x_content">
            <table class="table table-hover">
                <thead>
                <tr>
                    <th>#</th>
                    <th>账号</th>
                    <th>昵称</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($admins as $v)
                <tr>
                    <th scope="row">{{$v['id']}}</th>
                    <td>{{$v['name']}}</td>
                    <td>{{$v['nickname']}}</td>
                    <td>{{$v['created_at']}}</td>
                    <td>
                        <a href="/admin/adminuser/showRole/{{$v['id']}}" class="label label-warning">分配角色</a>
                        <button type="button" class="label label-success" data-toggle="modal" data-target=".bs-example-modal-sm{{$v['id']}}">编辑</button>
                        <a class="label label-danger" onclick="del('{{$v['id']}}','/admin/adminuser/','/admin/adminuser')">删除</a>
                        @component('components.modal',['class'=>'bs-example-modal-sm' . $v['id'],'title'=>'编辑用户','url'=>'/admin/adminuser/' . $v['id'],'method'=>'PUT'])
                            <div class="form-group">
                                <label style="margin-top: 10px;" class="control-label col-md-4 col-sm-4 col-xs-12" for="first-name">登录账号 <span class="required">*</span>
                                </label>
                                <div class="col-md-8 col-sm-8 col-xs-12">
                                    <input type="text" id="first-name" required="required" placeholder="请输入账号..." name="name" value="{{$v['name']}}" class="form-control col-md-7 col-xs-12">
                                </div>
                                <div class="clearfix"></div>
                            </div>
                            <div class="form-group">
                                <label style="margin-top: 10px;" class="control-label col-md-4 col-sm-4 col-xs-12" for="first-name">用户昵称 <span class="required">*</span>
                                </label>
                                <div class="col-md-8 col-sm-8 col-xs-12">
                                    <input type="text" id="first-name" required="required" placeholder="请输入昵称..." name="nickname" value="{{$v['nickname']}}" class="form-control col-md-7 col-xs-12">
                                </div>
                                <div class="clearfix"></div>

                            </div>
                            <div class="form-group">
                                <label style="margin-top: 10px;" class="control-label col-md-4 col-sm-4 col-xs-12" for="first-name">登录密码 <span class="required">*</span>
                                </label>
                                <div class="col-md-8 col-sm-8 col-xs-12">
                                    <input type="text" id="first-name"  placeholder="不填写则不修改" name="password" class="form-control col-md-7 col-xs-12">
                                </div>
                            </div>
                        @endcomponent
                    </td>
                </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
@endsection
